home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_023 / ver30 / tty / atari / ttykbd.c < prev   
C/C++ Source or Header  |  1992-05-06  |  2KB  |  99 lines

  1. /*
  2.  * Name:    MicroEMACS
  3.  *        Atari 520ST keyboard.
  4.  * Version:    30
  5.  * Last edit:    22-Feb-86
  6.  * By:        rex::conroy
  7.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  8.  */
  9. #include    "def.h"
  10. #include    <osbind.h>
  11.  
  12. /*
  13.  * Key names.
  14.  */
  15. char    *keystrings[] = {
  16.     NULL,        "F1",        "F2",        "F3",
  17.     "F4",        "F5",        "F6",        "F7",
  18.     "F8",        "F9",        "F10",        "Help",
  19.     "Undo",        "Insert",    "Up",        "Clr/Home",
  20.     "Left",        "Down",        "Right",    NULL,
  21.     NULL,        NULL,        NULL,        NULL,
  22.     NULL,        NULL,        NULL,        NULL,
  23.     NULL,        NULL,        NULL,        NULL
  24. };
  25.  
  26. /*
  27.  * This function is used to read the
  28.  * keyboard for the first time. A call to the system
  29.  * is made directly, to see the 32 bit key code. If the
  30.  * scan code says this is a function key, remap the
  31.  * codes. I might want to make the "Alt" key work like
  32.  * a "Meta" key, by looking at scan code.
  33.  */
  34. getkbd()
  35. {
  36.     register long    rawkey;
  37.     register int    k;
  38.  
  39.     rawkey = Crawcin();
  40.     k = (rawkey>>16) & 0xFF;        /* Scan code.        */
  41.     if (k == 0x3B)
  42.         return (KF1);
  43.     if (k == 0x3C)
  44.         return (KF2);
  45.     if (k == 0x3D)
  46.         return (KF3);
  47.     if (k == 0x3E)
  48.         return (KF4);
  49.     if (k == 0x3F)
  50.         return (KF5);
  51.     if (k == 0x40)
  52.         return (KF6);
  53.     if (k == 0x41)
  54.         return (KF7);
  55.     if (k == 0x42)
  56.         return (KF8);
  57.     if (k == 0x43)
  58.         return (KF9);
  59.     if (k == 0x44)
  60.         return (KF10);
  61.     if (k == 0x62)
  62.         return (KHELP);
  63.     if (k == 0x61)
  64.         return (KUNDO);
  65.     if (k == 0x52)
  66.         return (KINSERT);
  67.     if (k == 0x48)
  68.         return (KUP);
  69.     if (k == 0x47)
  70.         return (KCLEAR);
  71.     if (k == 0x4B)
  72.         return (KLEFT);
  73.     if (k == 0x50)
  74.         return (KDOWN);
  75.     if (k == 0x4D)
  76.         return (KRIGHT);
  77.     return ((int)(rawkey&0x7F));
  78. }
  79.  
  80. /*
  81.  * Establish default keypad
  82.  * bindings. The "Undo" key is bound to the
  83.  * "execute-macro"; this is where I bind "Do" on
  84.  * an LK201, and it is very handy.
  85.  * All of the Fn keys are bindable, but there
  86.  * are no default bindings.
  87.  */
  88. ttykeymapinit()
  89. {
  90.     keydup(KHELP,    "help");
  91.     keydup(KUNDO,    "execute-macro");
  92.     keydup(KINSERT,    "yank");
  93.     keydup(KUP,    "back-line");
  94.     keydup(KCLEAR,    "kill-region");
  95.     keydup(KLEFT,    "back-char");
  96.     keydup(KDOWN,    "forw-line");
  97.     keydup(KRIGHT,    "forw-char");
  98. }
  99.